import { PixelRatio, Dimensions } from 'react-native';

const dp2px = dp => PixelRatio.getPixelSizeForLayoutSize(dp);
const px2dp = px => PixelRatio.roundToNearestPixel(px);

// 此处是设计稿宽高
let designSize = { width: 720, height: 1280 };

let pxRatio = PixelRatio.get();
let win_width = Dimensions.get("window").width;
let win_height = Dimensions.get("window").height;

let width = dp2px(win_width);
let height = dp2px(win_height);

let design_scale = designSize.width/width;
height = height * design_scale;

let scale = 1/pxRatio/design_scale;
console.log('查看适配', width, height, scale);
export const container = {
    width: width,
    height: height,
    transform: [
        { translateX: -width * 0.5 },
        { translateY: -height * 0.5 },
        { scale: scale },
        { translateX: width * 0.5 },
        { translateY: height * 0.5 }
    ]
}